package com.gmail.yesguxun.tumblr.ui;

import com.gmail.yesguxun.tumblr.TrAccount;
import com.gmail.yesguxun.tumblr.content.TrContentProvider;
import com.gmail.yesguxun.util.LogFactory;
import com.gmail.yesguxun.util.LogX;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;


public class StartupActivity extends Activity {
	
	private LogX mLog = LogFactory.getLogObject();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		TrAccount account = TrAccount.getTrAccount();
		
		if(!account.isAccountInfoValid())
		{
    		account.setContext(getApplicationContext());
    		account.load();		
		}
		
		if(account.isAccountInfoValid())
		{
			mLog.debug("tumblr", "Starting ViewBigPhotoActivity");
			Intent myIntent = new Intent(this, ViewBigPhotoActivity.class);
			this.startActivity(myIntent);
		}
		else
		{
			mLog.debug("tumblr", "Starting SettingActivity");
			Intent myIntent = new Intent(this, SettingActivity.class);
			this.startActivity(myIntent);
		}
		
		
		mLog.debug("tumblr", "StartupActivity : Kill myself");
		finish();
	}
}
